package com.example.spring_trans.controller;

import com.example.spring_trans.service.LogService;
import com.example.spring_trans.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Li_yizYa
 * Date: 2025/7/25
 * Time: 15:37
 */
@Slf4j
@RequestMapping("/proga")
@RestController
public class PropagationController {

    @Autowired
    private UserService userService;
    @Autowired
    private LogService logService;

    /**
     * A 调用 B
     * @param name
     * @param password
     * @return
     */
    @Transactional
    @RequestMapping("/p1")
    public String registry9(String name, String password) {
        // 用户注册
        userService.registryUser(name, password);
        logService.insertLog(name, password);

        return "注册成功";
    }
}
